package DataStructure.Tree.binaryTree;

import java.awt.*;

/**
 * @Author: Dijah
 * @Date: 2023/8/8 17:36
 * @Desc: 定义二叉树
 */
public class BinaryTree {

    private TreeModel root;//根节点

    public void setRoot(TreeModel root){
        this.root = root;
    }

    //前序
    public void preOrder(){
        if(this.root != null){
            this.root.dLRTree();
        }else{
            System.out.println("二叉树为null");
        }
    }

    //中序遍历
    public void infixOrder(){
        if(this.root != null){
            this.root.lDRTree();
        }else{
            System.out.println("二叉树为null");
        }
    }

    //后续遍历
    public void postOrder(){
        if(this.root != null){
            this.root.lRDTree();
        }else{
            System.out.println("二叉树为null");
        }
    }
}
